Feat: discovery cache, get_model_info, and ModelFamily constants#63
Merged
Conversation
Add caching for model discovery and centralize model lookup logic in UiPathBaseSettings so all consumers (LangChain factory, LiteLLM client) share the same cached discovery and filtering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
base_url, tenant_id, organization_id, and access_token are required for Platform settings — declare them as required fields (like LLMGateway) instead of Optional with a validator check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_available_models()results are now cached onUiPathBaseSettings, keyed by(base_url, org_id, tenant_id)for Platform and(base_url, org_id, tenant_id, requesting_product)for LLMGateway. Passrefresh=Trueto bypass the cache.get_model_info()method onUiPathBaseSettingshandles model filtering by name, vendor, and BYO connection ID — with automaticvalidate_byo_model()for non-UiPath-owned models. Replaces duplicated logic in the LangChain factory and LiteLLM client.ModelFamilyStrEnum: New constants (OPENAI,GOOGLE_GEMINI,ANTHROPIC_CLAUDE) replace bare strings andmodelSubscriptionTypechecks for Azure vs non-Azure OpenAI routing.Packages affected
Both core (
uipath-llm-client) and langchain (uipath-langchain-client) — version bump1.8.3→1.9.0.Test plan
ruff check/ruff format --check/pyright— all cleanTestDiscoveryCachetests: cache hit,refresh=Truebypass, separate caches per settings, cache key includesrequesting_productTestGetModelInfotests: name lookup, case-insensitive, unknown model error, vendor filter, BYO connection filter, UiPathOwned preference,validate_byo_modelintegration🤖 Generated with Claude Code